<?php
require_once 'Zend/Controller/Action.php';
require_once 'Usuarios/ResourcesProvider.class.php';
require_once 'Usuarios/RolesProvider.class.php';

class GestionRoles_IndexController extends Zend_Controller_Action {
	public function preDispatch() {
		$auth = Zend_Auth :: getInstance();
		if (!$auth->hasIdentity()) {
			$this->_redirect('acceso/auth/login');
		}
		$zend_acl = Gea_Zend_Acl_Factory :: getInstance();
		if (!$zend_acl->isAllowed($auth->getIdentity()->ROL_ID, $this->getRequest()->getModuleName())) {
			$this->_redirect('/');
		}
	}

	public function init() {
		$registry = Zend_Registry :: getInstance();
		$this->smarty = $registry->smarty;
		$this->smarty->assign('baseUrl', $this->getRequest()->getBaseUrl());
		$this->smarty->assign('moduleName', $this->getRequest()->getModuleName());
		$this->smarty->assign('controllerName', $this->getRequest()->getControllerName());
		$this->smarty->assign('actionName', $this->getRequest()->getActionName());
		$this->smarty->assign('subtitulo', 'Gestion de Roles');
	}

	public function indexAction() {
		$this->smarty->displayInMasterPage('gestionroles_index_index.tpl', 'masterPage.tpl');
	}
}
?>
